package com.xiaobaibai.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.xiaobaibai.handler.ListTypeHandler;
import com.xiaobaibai.valid.AddGroup;
import com.xiaobaibai.valid.ListValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author xiaobaibai
 * @since 2020-10-27
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("product_evaluation")
@ApiModel(value="ProductEvaluation对象", description="")
public class ProductEvaluation implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "客户端评价时用")
    @TableField(exist = false)
    public String orderItemId;//评价时需要带上子项目的id,为了检验是否为对应的商品,且是否为对应的用户

    @ApiModelProperty(value = "商品评价表")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "商品id")
    @TableField("product_id")
    @NotNull(message = "请指定商品id")
    private Integer productId;

    @ApiModelProperty(value = "商品名称")
    @TableField("product_name")
    private String productName;

    @ApiModelProperty(value = "用户id")
    @TableField("user_id")
    private Integer userId;

    @ApiModelProperty(value = "用户昵称")
    @TableField("user_name")
    private String userName;

    @ApiModelProperty(value = "用户头像")
    @TableField("user_image")
    private String userImage;

    @ApiModelProperty(value = "评价等级:差中好012")
    @TableField("evaluation_level")
    @NotNull(message = "请指定评价等级")
    @ListValue(values = {0,1,2},message = "请输入正确的评价等级")
    private Integer evaluationLevel;

    @ApiModelProperty(value = "评价内容(限定255个字符)")
    @TableField("evaluation_content")
    @Length(max = 250,message = "评价内容过长")
    private String evaluationContent;

    @ApiModelProperty(value = "评价晒图(仅限5张)")
    @TableField(value = "evaluation_image",typeHandler = ListTypeHandler.class)
    private List<String> evaluationImage;

    @ApiModelProperty(value = "客服回应评价(限定255个字符)")
    @TableField("customer_content")
    @Null(message = "非法参数")
    @Length(max = 255,message = "回复内容过长")
    private String customerContent;

    @ApiModelProperty(value = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private Date createTime;

}
